//
// Created by 86155 on 2025/7/4.
//

#ifndef LLVM_FEDATACTRL_H
#define LLVM_FEDATACTRL_H
#include <iostream>
#include <string>
#include <vector>

struct Node {
  std::string str;
  std::vector<int> arr;
  Node* next;
  Node(const std::string& s) : str(s), next(nullptr) {}
};
class LinkedList {
private:
  Node* head;
  Node* tail;

public:
  LinkedList() : head(nullptr), tail(nullptr) {}

  ~LinkedList() {
    while (head) {
      Node* temp = head;
      head = head->next;
      delete temp;
    }
  }

  void append(const std::string& str, const std::vector<int>& arr) {
    Node* newNode = new Node(str);
    newNode->arr = arr;

    if (!head) {
      head = tail = newNode;
    } else {
      tail->next = newNode;
      tail = newNode;
    }
  }

  void print() const {
    Node* current = head;
    while (current) {
      std::cout << "String: " << current->str << std::endl;
      std::cout << "Array: ";
      for (int num : current->arr) {
        std::cout << num << " ";
      }
      std::cout << std::endl << std::endl;
      current = current->next;
    }
  }

  std::vector<int> findbyName(const std::string& str) const {
    Node* current = head;
    std::vector<int> arr;
    while (current) {
      if(str == current->str){
        for (int num : current->arr) {
          arr.push_back(num);
        }
        std::cout << std::endl << std::endl;
      }
      current = current->next;
    }
    return arr;
  }
};

class FeDataCtrl {
private:
  int mem[50];
  int inbuffer[100];
  int outbuffer[100];

public:
  FeDataCtrl();
  int RAC;
  int x=4;

  LinkedList list;
  void insdin(int ,int );
  void insdout(int ,int );
  void setData();                 //设置存控及缓冲区数据
  void displayInbufferData();
  void displayOutbufferData();
  void displaymemData();
  void insrac(int ,int);
};
extern FeDataCtrl dataCtrl;
#endif // LLVM_FEDATACTRL_H
